package com.yy.mall.cart.config;

import com.yy.mall.cart.interceptor.CartInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author lzy
 * @date 2021/9/28 16:12
 */
@Configuration
public class CartWebConfig implements WebMvcConfigurer {

    @Autowired
    CartInterceptor cartInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration registration = registry.addInterceptor(cartInterceptor);
        registration.addPathPatterns("/**");
        registration.excludePathPatterns("/v1/**");
    }
}